<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class main extends CI_Controller {
	
	function __construct(){
		parent::__construct();
		$this->load->model('mdl_daftar_penduduk');
		$this->load->model('mdl_daftar_keluarga');
		$this->load->model('mdl_daftar_surat');
	}
	
	public function index(){
		//$data['universitas'] = $this->mdl_universitas->getsingledata();
		$this->load->view('main');
	}
	
	public function dashboard(){
		$data['mhsCount'] =  $this->mdl_daftar_penduduk->getDataCount();
		$data['mhsActCount'] =  $this->mdl_daftar_penduduk->getDataCount('ma');
		$data['klgCount'] =  $this->mdl_daftar_keluarga->getDataCount();
		$data['suratCount'] =  $this->mdl_daftar_surat->getDataCount();
		
		// $data['lblDiagram'] = array("2009","2010","2011","2012","2013","2014","2015", "2016");
		// $data['dataDiagram'] = $this->mdl_daftar_penduduk->getDataChart($data['lblDiagram']);
		$data['lblDiagram'] = array("");
		$data['balita'] = $this->mdl_daftar_penduduk->getDataChartUmurB($data['lblDiagram']);
		$data['anak_anak'] = $this->mdl_daftar_penduduk->getDataChartUmurA($data['lblDiagram']);
		$data['remaja'] = $this->mdl_daftar_penduduk->getDataChartUmurR($data['lblDiagram']);
		$data['dewasa'] = $this->mdl_daftar_penduduk->getDataChartUmurD($data['lblDiagram']);
		$data['tua'] = $this->mdl_daftar_penduduk->getDataChartUmurT($data['lblDiagram']);
		//$data['dataDiagram'] = $this->mdl_daftar_penduduk->getDataChartAgama($data['lblDiagram']);
		$data['dataJK'] = $this->mdl_daftar_penduduk->getDataGraph();
		
		$data['lblDiagram2'] = array("Kaya","Mampu", "Cukup","Kurang Mampu","Miskin");

		$data['dataDiagram2'] = $this->mdl_daftar_keluarga->getDataChartEkonomi($data['lblDiagram2']);
		$data['totalData'] = $this->mdl_daftar_keluarga->getDataChartEkonomi($data['lblDiagram']);
		
		$data['lblDiagram2'] = array("Kaya","Mampu", "Cukup","Kurang Mampu","Miskin");
		$data['dataEkonomi'] = $this->mdl_daftar_keluarga->getDataGraph();
		
		$this->load->view('layout/beranda',$data);
	}

	public function ekonomi(){
		
		


		$this->load->view('layout/beranda',$data);
		//$this->load->view('berdasar_j_kel',$data);
	}
	
}